import { getCountryList } from '/@/api/sys';
import { FormSchema } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';
import { useFormLabelWidth } from '/@/hooks/setting/useFormLabelSetting';
const { t } = useI18n();
const labelWidth: number = useFormLabelWidth('editPaymentCard');
const FormSchemaFormat: any = (currency_id) => {
  return [
    {
      field: 'id',
      component: 'Input',
      // labelWidth: 85,
      show: false,
    },
    {
      field: 'username',
      component: 'Input',
      labelWidth: labelWidth,
      label: t('modalForm.member.member_account'), //会员账号
      componentProps: {
        disabled: true,
        placeholder: t('modalForm.member.member_p_enter_username'), //请输入会员账号
      },
    },
    {
      field: 'open_name',
      component: 'Input',
      labelWidth: labelWidth,
      label: t('modalForm.member.member_username'), //会员姓名
      componentProps: {
        disabled: true,
        placeholder: t('请输入'), //请输入
      },
    },
    {
      field: 'type_name',
      component: 'Input',
      labelWidth: labelWidth,
      label: t('modalForm.member.member_withdrawal_method'), //
      componentProps: {
        disabled: true,
        placeholder: t('请输入'), //
      },
    },
    {
      field: 'bank_name',
      component: 'Input',
      labelWidth: labelWidth,
      label: t('modalForm.member.member_withdrawal_type'), //
      componentProps: {
        disabled: true,
        placeholder: t('请输入'), //
      },
    },
    {
      field: 'address',
      component: 'Input',
      labelWidth: labelWidth,
      label: t('modalForm.member.member_account_opening_outlets'), //
      componentProps: {
        placeholder: t('请输入'), //
      },
      rules: [
        {
          required: true,
          validator: (rule, value) => {
            if (value && value.length > 100) {
              return Promise.reject(t('最大长度不能超过100'));
            }
            if (!!!value) {
              return Promise.reject(t('请输入开户网点'));
            }
            return Promise.resolve();
          },
        },
      ],
      ifShow: currency_id == '701',
    },
    {
      field: 'bank_account',
      component: 'Input',
      labelWidth: labelWidth,
      label: t('modalForm.member.member_payment_account_number'), //
      componentProps: {
        placeholder: t('请输入'), //
      },
      rules: [
        {
          required: true,
          validator: (rule, value) => {
            if (value && value.length > 100) {
              return Promise.reject(t('最大长度不能超过100'));
            }
            if (!!!value) {
              return Promise.reject(t('请输入收款账号'));
            }
            return Promise.resolve();
          },
        },
      ],
    },
  ];
};
useFormLabelWidth(FormSchemaFormat);
export const accountFormSchema = FormSchemaFormat;
